Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(contracts): remove sub() from gas() in staticcall at SemaphoreVerifier #883

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jimmychu0807
Copy link
Contributor

@jimmychu0807 jimmychu0807 commented Oct 23, 2024

Description

Close #871

Other Info

Original gas usage:

·-----------------------------------------------|---------------------------|-------------|-----------------------------·
|             Solc version: 0.8.23              ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 30000000 gas  │
················································|···························|·············|······························
|  Methods                                                                                                              │
··············|·································|·············|·············|·············|···············|··············
|  Contract   ·  Method                         ·  Min        ·  Max        ·  Avg        ·  # calls      ·  usd (avg)  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  acceptGroupAdmin               ·          -  ·          -  ·      29066  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  addMember                      ·     117970  ·     157140  ·     133880  ·           15  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  addMembers                     ·     222218  ·     302814  ·     288637  ·            6  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·      54745  ·      91757  ·      82504  ·            4  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·          -  ·          -  ·      91038  ·            3  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·      74496  ·      91596  ·      90281  ·           26  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  removeMember                   ·          -  ·          -  ·     128981  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateGroupAdmin               ·          -  ·          -  ·      48343  ·            4  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateGroupMerkleTreeDuration  ·          -  ·          -  ·      30748  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateMember                   ·          -  ·          -  ·     212377  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  validateProof                  ·          -  ·          -  ·     290144  ·            5  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Deployments                                  ·                                         ·  % of limit   ·             │
················································|·············|·············|·············|···············|··············
|  PoseidonT3                                   ·          -  ·          -  ·    3693362  ·       12.3 %  ·          -  │
················································|·············|·············|·············|···············|··············
|  Semaphore                                    ·          -  ·          -  ·    1820135  ·        6.1 %  ·          -  │
················································|·············|·············|·············|···············|··············
|  SemaphoreVerifier                            ·          -  ·          -  ·    3722864  ·       12.4 %  ·          -  │
·-----------------------------------------------|-------------|-------------|-------------|---------------|-------------·

With this PR:

·-----------------------------------------------|---------------------------|-------------|-----------------------------·
|             Solc version: 0.8.23              ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 30000000 gas  │
················································|···························|·············|······························
|  Methods                                                                                                              │
··············|·································|·············|·············|·············|···············|··············
|  Contract   ·  Method                         ·  Min        ·  Max        ·  Avg        ·  # calls      ·  usd (avg)  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  acceptGroupAdmin               ·          -  ·          -  ·      29066  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  addMember                      ·     117970  ·     157140  ·     133880  ·           15  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  addMembers                     ·     222218  ·     302814  ·     288637  ·            6  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·      54745  ·      91757  ·      82504  ·            4  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·          -  ·          -  ·      91038  ·            3  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  createGroup                    ·      74496  ·      91596  ·      90281  ·           26  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  removeMember                   ·          -  ·          -  ·     128981  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateGroupAdmin               ·          -  ·          -  ·      48343  ·            4  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateGroupMerkleTreeDuration  ·          -  ·          -  ·      30748  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  updateMember                   ·          -  ·          -  ·     212377  ·            2  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Semaphore  ·  validateProof                  ·          -  ·          -  ·     290102  ·            5  ·          -  │
··············|·································|·············|·············|·············|···············|··············
|  Deployments                                  ·                                         ·  % of limit   ·             │
················································|·············|·············|·············|···············|··············
|  PoseidonT3                                   ·          -  ·          -  ·    3693362  ·       12.3 %  ·          -  │
················································|·············|·············|·············|···············|··············
|  Semaphore                                    ·          -  ·          -  ·    1820135  ·        6.1 %  ·          -  │
················································|·············|·············|·············|···············|··············
|  SemaphoreVerifier                            ·          -  ·          -  ·    3720284  ·       12.4 %  ·          -  │
·-----------------------------------------------|-------------|-------------|-------------|---------------|-------------·

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link

chore(contracts): remove sub() from gas() in staticcall at SemaphoreVerifier

Generated at commit: 31f891b52c3bb08fc98e221880004c378165b002

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
3
15
18
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove sub() from gas() in SemaphoreVerifier.sol
1 participant